<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位</title>
    <style>
        .container{
            width: 300px;
            height: 300px;
            background-color: red;
            position: relative;
            margin: 50px,50px;
        }
        .item1,.item2,.item3,.item4,.item5,.item6,.item7,.item8,.item9{
            width: 50px;
            height: 50px;
            background-color: blue;
            position: absolute;
        }
        .item2{
            background-color: aqua;
            left: 50%;
            transform: translate(-50%);
        }
        .item3{
            background-color: bisque;
            right: 0;
        }
        .item4{
            background-color: aqua;
            top: 50%;
            transform: translateY(-50%); 
        }
        .item5{
            background-color: bisque;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .item6{
            background-color: aqua;
            right: 0;
            bottom: 50%;
            transform: translateY(50%); 
        }
        .item7{
            background-color: aqua;
            bottom: 0;
        }
        .item8{
            background-color: aqua;
            left: 50%;
            top: 100%;
            transform: translate(-50%,-100%);
        }
        .item9{
            background-color: aqua;
            bottom: 0;
            right: 0;
        }


        
    </style>
</head>
<body>
    <div class="container">
        <div class="item1"></div>
        <div class="item2"></div>
        <div class="item3"></div>
        <div class="item4"></div>
        <div class="item5"></div>
        <div class="item6"></div>
        <div class="item7"></div>
        <div class="item8"></div>
        <div class="item9"></div>
    </div>
    
</body>
</html>